<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "knowmap".
 *
 * @property integer $id
 * @property string $mapID
 * @property string $mapName
 * @property string $mapDescription
 * @property string $KnowRelationID
 * @property string $mapType
 * @property string $userID
 * @property string $addTime
 * @property string $modifyTime
 * @property string $heatLeave
 */
class KnowmapModel extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'knowmap';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['addTime', 'modifyTime'], 'safe'],
            [['mapID', 'mapName', 'mapDescription', 'KnowRelationID', 'mapType', 'userID', 'heatLeave'], 'string', 'max' => 255],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'mapID' => 'Map ID',
            'mapName' => '图谱名称',
            'mapDescription' => '图谱简介',
            'KnowRelationID' => 'Know Relation ID',
            'mapType' => '图谱类型',
            'userID' => '图谱创建人',
            'addTime' => '创建时间',
            'modifyTime' => 'Modify Time',
            'heatLeave' => '图谱热度',
        ];
    }
    
    public function getNormalList(){
        $data=array();
        $res= self::find()->asArray()->all();
        if($res){
            foreach ($res as $key => $value) {
                $temp['mapName']=$value['mapName'];
                $temp['heatLeave']=$value['heatLeave'];
                array_push($data, $temp);
            }
        }
        return $data;
    }
}
